﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TaskListManager
{
   [Serializable()]
   class User
   {
      protected int m_lUserIdent;
      protected string m_strUserName;

      public User()
      {
         m_lUserIdent = -1;
         m_strUserName = "";
      }

      public override int GetHashCode()
      {
         return (m_strUserName.GetHashCode() ^ m_lUserIdent);
      }

      public override bool Equals(object obj)
      {
         bool bRet = false;
         if (obj == null)
         {
            bRet = false;
         }
         else
         {
            User sUsr = obj as User;
            if (sUsr == null)
            {
               bRet = false;
            }
            else
            {
               bRet = (sUsr.m_lUserIdent == m_lUserIdent);
            }
         }
         return bRet;
      }

      public int UserId
      {
         get
         {
            return m_lUserIdent;
         }
         set
         {
            m_lUserIdent = value;
         }
      }

      public string UserName
      {
         get
         {
            return m_strUserName;
         }
         set
         {
            m_strUserName = value;
         }
      }
   }
}
